/**
 * 文物基础类型定义
 */

// 文物材质
export interface Material {
  id: string
  name: string
  nameEn: string
  description: string
  descriptionEn: string
}

// 考古图层
export interface ArchaeologicalLayer {
  id: string
  name: string
  nameEn: string
  depth: number // 深度（米）
  period: string // 时期
  periodEn: string
  description: string
  descriptionEn: string
  imageUrl?: string
}

// 3D模型配置
export interface ModelConfig {
  url: string // 3D模型文件URL
  scale: number // 缩放比例
  position: { x: number; y: number; z: number }
  rotation: { x: number; y: number; z: number }
}

// 光照配置
export interface LightConfig {
  id: string
  name: string
  nameEn: string
  type: 'ambient' | 'directional' | 'point' | 'spot'
  intensity: number
  color: string
  position?: { x: number; y: number; z: number }
}

// 文物基础接口
export interface Artifact {
  id: string
  name: string // 中文名称
  nameEn: string // 英文名称
  dynasty: string // 朝代
  dynastyEn: string
  period: string // 时期
  periodEn: string
  description: string // 描述
  descriptionEn: string
  story: string // 文物故事
  storyEn: string
  coverImage: string // 封面图
  modelConfig: ModelConfig // 3D模型配置
  materials: Material[] // 材质列表
  archaeologicalLayers: ArchaeologicalLayer[] // 考古图层
  lightConfigs: LightConfig[] // 光照配置
  aiPrompt: string // AI对话预置prompt
  aiPromptEn: string
  themeId: string // 所属主题ID
}

// 文物基础类
export class ArtifactBase implements Artifact {
  id: string
  name: string
  nameEn: string
  dynasty: string
  dynastyEn: string
  period: string
  periodEn: string
  description: string
  descriptionEn: string
  story: string
  storyEn: string
  coverImage: string
  modelConfig: ModelConfig
  materials: Material[]
  archaeologicalLayers: ArchaeologicalLayer[]
  lightConfigs: LightConfig[]
  aiPrompt: string
  aiPromptEn: string
  themeId: string

  constructor(data: Artifact) {
    this.id = data.id
    this.name = data.name
    this.nameEn = data.nameEn
    this.dynasty = data.dynasty
    this.dynastyEn = data.dynastyEn
    this.period = data.period
    this.periodEn = data.periodEn
    this.description = data.description
    this.descriptionEn = data.descriptionEn
    this.story = data.story
    this.storyEn = data.storyEn
    this.coverImage = data.coverImage
    this.modelConfig = data.modelConfig
    this.materials = data.materials
    this.archaeologicalLayers = data.archaeologicalLayers
    this.lightConfigs = data.lightConfigs
    this.aiPrompt = data.aiPrompt
    this.aiPromptEn = data.aiPromptEn
    this.themeId = data.themeId
  }

  // 获取本地化名称
  getName(locale: 'zh' | 'en' = 'zh'): string {
    return locale === 'zh' ? this.name : this.nameEn
  }

  // 获取本地化描述
  getDescription(locale: 'zh' | 'en' = 'zh'): string {
    return locale === 'zh' ? this.description : this.descriptionEn
  }

  // 获取本地化故事
  getStory(locale: 'zh' | 'en' = 'zh'): string {
    return locale === 'zh' ? this.story : this.storyEn
  }

  // 获取本地化AI提示词
  getAiPrompt(locale: 'zh' | 'en' = 'zh'): string {
    return locale === 'zh' ? this.aiPrompt : this.aiPromptEn
  }
}

